package com.bignerdranch.android.ecar.Activity;

import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bignerdranch.android.ecar.Adapter.MaintainAdapter;
import com.bignerdranch.android.ecar.Bean.MaintainBean;
import com.bignerdranch.android.ecar.R;

import java.util.ArrayList;
import java.util.List;

public class MaintainActivity extends BaseActivity implements View.OnClickListener {

    private ImageButton maintain_back;
    private ListView maintain_list;
    private RelativeLayout price;
    private RelativeLayout number;
    private RelativeLayout car;
    private TextView price_old;
    private List<MaintainBean> mData;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maintain);
        initView();
        initData();
        maintain_list.setAdapter(new MaintainAdapter(this,mData));

    }

    private void initView() {
        maintain_back = (ImageButton) findViewById(R.id.maintain_back);
        maintain_list = (ListView) findViewById(R.id.maintain_list);

        maintain_back.setOnClickListener(this);
        price = (RelativeLayout) findViewById(R.id.price);
        price.setOnClickListener(this);
        number = (RelativeLayout) findViewById(R.id.number);
        number.setOnClickListener(this);
        car = (RelativeLayout) findViewById(R.id.car);
        car.setOnClickListener(this);
        price_old = (TextView)findViewById(R.id.price_old);
//        price_old.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
    }

    private void initData(){
        mData = new ArrayList<>();
        for(int i = 0;i < 10;i++){
            MaintainBean bean = new MaintainBean(R.drawable.sample,"农业路"+i+"号","套餐名字","200人已预约","¥200","¥100");

            mData.add(bean);
        }
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.maintain_back:
                finish();
                break;
        }
    }
}
